#define  _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdlib.h>
int main()
{
	int n = 0;
	int m = 0;
	scanf("%d%d", &n, &m);
	double MaxScore = 0.0;
	while (n--)
	{
		double* score = (double*)calloc(m, sizeof(double));
		double min = 10;
		double max = 0;
		for (int i = 0; i < m; i++)
		{
			scanf("%lf", score + i);
			if (score[i] > max)max = score[i];
			if (score[i] < min)min = score[i];
		}
		double sum = 0;
		for (int j = 0; j < m; j++)
		{
			sum += score[j];
		}
		if ((sum - min - max) > MaxScore)MaxScore = sum - min - max;
	}
	printf("%.2lf", MaxScore / (m - 2));
	return 0;
}